<?php
/**
 * 公共控制器
 */
namespace V3\Controller;
use Think\Controller;
use Think\Upload;

class ApiCommonController extends Controller
{
	protected $_userid = 0;
	protected $_bcid = '';

    function _initialize()
    {
    	header("Content-Type:text/html;charset=UTF-8");
		//设置时区
		date_default_timezone_set('PRC');
        
    	//$ua = parseUserAgent($_SERVER['HTTP_USER_AGENT']);
    	//$ua = parseUserAgent($ua_test);
    	//重新生成$_REQUEST
    	$_REQUEST = array_merge($ua, $_GET, $_POST);
    }
    
    protected function getUserId() {
    	$user_id = $_REQUEST['user_id'] ? $_REQUEST['user_id'] : 0;
    	if (!$user_id) {
    		$user_id = $this->_userid;
    	}
    
    	if (!$user_id) {
    		$user_id =  $_REQUEST['u_userid'] ? $_REQUEST['u_userid'] : 0;
    	}
    
    	return $user_id;
    }
	
   
}
